package com.woniuxy.background.service.impl;

import com.woniuxy.background.dao.UserMapper;
import com.woniuxy.background.pojo.User;
import com.woniuxy.background.service.UsersService;
import com.woniuxy.background.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UsersServiceImpl implements UsersService {

    @Autowired
    private UserMapper usersMapper;

    @Override
    public List<User> findUserByPage(Integer currentPage, Integer pageSize, UserVO vo) {
        return usersMapper.queryUsersByPage(currentPage,pageSize,vo);
    }

    @Override
    public void batchDeleteUser(List<Integer> list) {
        usersMapper.batchDeleteUser(list);
    }

   /* @Override
    public User findUserByEmail(String email) {
        return usersMapper.selectByEmail(email);
    }*/

    @Override
    public void saveUser(User user) {
        usersMapper.insertSelective(user);
    }

    @Override
    public User findById(int uid) {
        return usersMapper.selectByPrimaryKey(uid);
    }

    @Override
    public int deleteByPrimaryKey(Integer userId) {
        return usersMapper.deleteByPrimaryKey(userId);
    }

    @Override
    public void updateByPrimaryKeySelective(User user) {
        usersMapper.updateByPrimaryKeySelective(user);
    }

}
